<? 
include '../libraries/open_db_connection.php'; 
include '../libraries/get_values.php';
include '../auth/auth.php';
include '../libraries/support.php';
include 'gallery_events_realm.php';
include 'gallery_blog_realm.php';
function print_admin_navigator()
{
	?>
	<div id="navigator">
	<h3>Admin navigator</h3>
	<P><A href="gallery_admin.php?realm=events">List events</A></P>
	<P><A href="gallery_admin.php?realm=blog">List blog entries</A></P>
	<P><A href="index.php">Back to main admin panel</A></P>
	<P><A href="../auth/logout.php">Log out</A></P>
	</div>
	<?
}
function print_head()
{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
	<HTML>
	<HEAD>
	<TITLE>Gallery administration</TITLE>
	<script type="text/javascript"></script>
	
		<style type="text/css" media="all">
			@import "../bbogd.css";
		</style>

	</HEAD>
	<BODY>
	<?
	print_admin_navigator();
	?>
<div id="container">
<div id="main">
<?
}
function print_tail()
{
	?>
	</div>
	</div?
	</body>
	</html>
	<?
}


$action=$_GET['action'];
$realm=$_GET['realm'];

print_head();
if ($realm == "events")
{
	switch ($action)
	{
		case 'show':
			show_picture($_GET['picture']);
		break;
		case 'hide':
			hide_picture($_GET['picture'],$_GET['main']);
		break;
		case 'make_main':
			make_main_image($_GET['picture'],$_GET['event']);
		break;
		case 'save':
			save_info($_POST['picture']);
		break;
		default:
		;
	}
	print_all_events();
}
else if ($realm == "blog")
{
	switch ($action)
	{
		case 'show':
			if ($_GET['oldpic'] != "")
				hide_picture_blog($_GET['oldpic'],$_GET['main']);
			show_picture_blog($_GET['picture'],$_GET['main']);
		break;
		case 'hide':
			hide_picture_blog($_GET['picture'],$_GET['main']);
		break;
		case 'save':
			save_info($_POST['picture']);
		break;
		default:
		;
	}
	print_all_entries();
}

include '../libraries/close_db_connection.php'; 
print_tail();
?>
